package mode.strategy;

/**
 * 支付接口抽象类
 *
 * @author xjx
 * @date 2023/7/31 10:10
 */
public abstract class Payment implements Pay {

    @Override
    public String pay(String uid, double money) {
        double balance = queryBalance(uid);
        if (balance < money) {
            return "支付失败!余额不足!欠" + (money - balance) + "元!";
        }
        return "支付成功!支付金额:" + money + "余额剩余:" + (balance - money);
    }
    protected abstract String getPaymentName();

    protected abstract double queryBalance(String uid);
}
